package com.example.demo.lc;

/**
 * @Description TODO
 * @Author wzh
 * @Date 2021/9/22 10:26 上午
 * @Version 1.0
 */
public class Leetcode1344 {
    public static void main(String[] args) {
        //int hour = 12, minutes = 30;
        //int hour = 3, minutes = 30;
        //int hour = 3, minutes = 15;
        //int hour = 4, minutes = 50;
        //int hour = 12, minutes = 0;
        int hour = 1, minutes = 4;
        System.out.println(angleClock(hour, minutes));
    }

    public static double angleClock(int hour, int minutes) {
        Integer hour_degrees = 30;  //360/12
        Integer min_degrees = 6;  //360/60
        double hour_total = (minutes / 60d + hour % 12) * hour_degrees;
        double min_total = min_degrees * minutes;
        double diff = Math.abs(hour_total - min_total);
        return Math.min(diff,360-diff);
    }
}
